<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="UTF-8">
    <title>Hello World!</title>
    <link rel="stylesheet" href="assets/element-plus@2.8.0/index.css"/>
    <link rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div id="app"></div>
<script src="assets/vue@3.4.37/vue.global.prod.min.js"></script>
<script src="assets/vue-router@4.4.3/vue-router.global.prod.min.js"></script>
<script src="assets/element-plus@2.8.0/index.full.min.js"></script>
<script src="assets/element-plus@2.8.0/index.iife.min.js"></script>
<script type="module" src="js/script.js"></script>
<!--
<h1>Hello World!</h1>
<p>
    We are using Node.js <span id="node-version"></span>,
    Chromium <span id="chrome-version"></span>,
    and Electron <span id="electron-version"></span>.
</p>
<div>
    <input type='text' id="memoInput">
    <input type='button' id='insertBtn' value='输入'>
</div>
<div id='gridTag'></div>

<button id="btn_java">获取数据库表的数据字典</button>
<div id="java_data"></div>

<link rel='stylesheet' href='https://unpkg.com/gridjs/dist/theme/mermaid.min.css'>
<script src='https://unpkg.com/gridjs/dist/gridjs.umd.js'></script>
<script>

    window.API.createDb().catch(err => {
        console.log(err)
    });

    let grid;
    window.API.selectAll().then(ret => {
        console.log(ret)
        ret.forEach((elem) => {
            delete elem.id
        });
        grid = new gridjs.Grid({data: ret}).render(document.getElementById('gridTag'));
    }).catch(err => {
        console.log(err)
    });

    document.getElementById('insertBtn').onclick = () => {
        const memoText = document.getElementById('memoInput').value;
        if (memoText) {
            window.API.insertData(memoText).catch(err => {
                console.log(err)
            });
        }

        document.getElementById('memoInput').value = "";

        window.API.selectAll().then(ret => {
            console.log(ret)
            ret.forEach((elem) => {
                delete elem.id
            });
            grid.updateConfig({data: ret}).forceRender();
        }).catch(err => {
            console.log(err)
        });
    }

    document.getElementById('btn_java').onclick = () => {
        window.API.javaData().then(ret => {
            console.log(ret)
            document.getElementById('java_data').innerHTML = ret
        }).catch(err => {
            console.log(err)
        });
    }
</script>
-->
</body>
</html>